#pragma once
#include "loadUtils.h"
#include <stdlib.h>
#include <string.h>

struct ProductVars{
	int id;
	char desc[50];
	int catid;
	int agentid;
	int stock;
	int deliverytime;
	int price;
};

struct ProductVars *productdata;
int productcount;
/**
 * @brief Load product file into memory
 *
 * @param filename
 *
 * @return return code
 */
int loadProducts(char const *filename);
/**
 * @brief save productdata to file
 *
 * @param filename
 *
 * @return return code
 */
int writeProducts(char const *filename);
/**
 * @brief add a product to the vector, reallocates if needed
 *
 * @param n
 */
void addProduct(struct ProductVars n);
/**
 * @brief removes a product by index, find it yourself first ;)
 *
 * @param index
 */
void rmProduct(int index);
